import Vue from 'vue'
import VueRouter from 'vue-router'
//import Home from '../views/Home.vue'
import Home from '../components/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/home"
  },
  {
    path: '/home',
    component: Home,
  },
  {
    path: '/member',
    component: () => import("../components/Member.vue")
  },
  {
    path: '/search',
    component: () => import("../components/Search.vue")
  },
  {
    path: '/home/newslist',
    component: () => import("../views/New/Newslist.vue")
  },
  {
    path: '/home/newslist/newdetail/:id',
    component: () => import("../views/New/Newdetail.vue"),
    props: true//启用props来接收路由参数
  },
  {
    path: '/home/picshare',
    component: () => import("../views/Pic/Picshare.vue"),
  },
  {
    path: "/home/picshare/picdetail/:id",
    component: () => import("../views/Pic/Picdetail.vue"),
    props: true
  },
  {
    path: "/home/shop",
    component: () => import("../views/Shop/Shopgoods.vue"),
  },
  {
    path: "/home/shop/:id",
    name: "goodsinfo",
    component: () => import("../views/Shop/Shopdetail.vue"),
  },
  {
    path: "/home/shop/shopdetail/:id",
    component: () => import("../views/Shop/Shopinfo.vue")
  },
  {
    path: "/home/shop/shopcom/:id",
    component: () => import("../views/Shop/Shopcom.vue")
  },
  {
    path: "/car",
    component:()=>import("../components/Shop.vue")
  }
]

const router = new VueRouter({
  routes,
  linkActiveClass: "mui-active"//手动被激活的类名
})

export default router
